package com.rain.log.controller;

import com.rain.log.entity.TestUser;
import com.rain.log.service.TestUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author admin
 */
@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private TestUserService testUserService;

    @GetMapping("/hello")
    public String hello() {
        return "Hello";
    }

    @GetMapping("/get_user/{userId}")
    public TestUser getUserById(@PathVariable("userId") Long userId) {
        // 参数校验

        return testUserService.getUserById(userId);
    }
}
